﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
using WmAutoUpdate;
using Microsoft.Win32;
using foursquare.Forms;

namespace foursquare
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
            string CFVersion = Environment.Version.Major.ToString() + "." + Environment.Version.Minor.ToString();

            if (Environment.Version.Major < 3)
            {
                //TODO: how to prompt user to download a newer CF version.
            }
            else
            {
                Updater updater = new Updater("http://nanek.net/wm/update.xml");
                updater.CheckForNewVersion();

                FSLocal.InitDatabase();
                FSLocal.LoadSavedCredentials();
                if (String.IsNullOrEmpty(FS.OAuthToken))
                    Application.Run(new LoginView());
                else
                    Application.Run(new HomeView());
            }
        }

        //TODO: cell tower triangulation in addition to GPS
        //TODO: display map of nearby places
        //TODO: turn off GPS lookup when app in the background or battery is low.

    }
}